Optimal. Leaf size=111 \[ -\frac {24 b \cos (c+d x)}{d^5}+\frac {2 a \cos (c+d x)}{d^3}+\frac {12 b x^2 \cos (c+d x)}{d^3}-\frac {a x^2 \cos (c+d x)}{d}-\frac {b x^4 \cos (c+d x)}{d}-\frac {24 b x \sin (c+d x)}{d^4}+\frac {2 a x \sin (c+d x)}{d^2}+\frac {4 b x^3 \sin (c+d x)}{d^2} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.11, antiderivative size = 111, normalized size of antiderivative = 1.00, number of steps
used = 10, number of rules used = 3, integrand size = 17, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.176, Rules used = {3420, 3377,
2718} \begin {gather*} \frac {2 a \cos (c+d x)}{d^3}+\frac {2 a x \sin (c+d x)}{d^2}-\frac {a x^2 \cos (c+d x)}{d}-\frac {24 b \cos (c+d x)}{d^5}-\frac {24 b x \sin (c+d x)}{d^4}+\frac {12 b x^2 \cos (c+d x)}{d^3}+\frac {4 b x^3 \sin (c+d x)}{d^2}-\frac {b x^4 \cos (c+d x)}{d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 2718
Rule 3377
Rule 3420
Rubi steps
\begin {align*} \int x^2 \left (a+b x^2\right ) \sin (c+d x) \, dx &=\int \left (a x^2 \sin (c+d x)+b x^4 \sin (c+d x)\right ) \, dx\\ &=a \int x^2 \sin (c+d x) \, dx+b \int x^4 \sin (c+d x) \, dx\\ &=-\frac {a x^2 \cos (c+d x)}{d}-\frac {b x^4 \cos (c+d x)}{d}+\frac {(2 a) \int x \cos (c+d x) \, dx}{d}+\frac {(4 b) \int x^3 \cos (c+d x) \, dx}{d}\\ &=-\frac {a x^2 \cos (c+d x)}{d}-\frac {b x^4 \cos (c+d x)}{d}+\frac {2 a x \sin (c+d x)}{d^2}+\frac {4 b x^3 \sin (c+d x)}{d^2}-\frac {(2 a) \int \sin (c+d x) \, dx}{d^2}-\frac {(12 b) \int x^2 \sin (c+d x) \, dx}{d^2}\\ &=\frac {2 a \cos (c+d x)}{d^3}+\frac {12 b x^2 \cos (c+d x)}{d^3}-\frac {a x^2 \cos (c+d x)}{d}-\frac {b x^4 \cos (c+d x)}{d}+\frac {2 a x \sin (c+d x)}{d^2}+\frac {4 b x^3 \sin (c+d x)}{d^2}-\frac {(24 b) \int x \cos (c+d x) \, dx}{d^3}\\ &=\frac {2 a \cos (c+d x)}{d^3}+\frac {12 b x^2 \cos (c+d x)}{d^3}-\frac {a x^2 \cos (c+d x)}{d}-\frac {b x^4 \cos (c+d x)}{d}-\frac {24 b x \sin (c+d x)}{d^4}+\frac {2 a x \sin (c+d x)}{d^2}+\frac {4 b x^3 \sin (c+d x)}{d^2}+\frac {(24 b) \int \sin (c+d x) \, dx}{d^4}\\ &=-\frac {24 b \cos (c+d x)}{d^5}+\frac {2 a \cos (c+d x)}{d^3}+\frac {12 b x^2 \cos (c+d x)}{d^3}-\frac {a x^2 \cos (c+d x)}{d}-\frac {b x^4 \cos (c+d x)}{d}-\frac {24 b x \sin (c+d x)}{d^4}+\frac {2 a x \sin (c+d x)}{d^2}+\frac {4 b x^3 \sin (c+d x)}{d^2}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.10, size = 75, normalized size = 0.68 \begin {gather*} \frac {-\left (\left (a d^2 \left (-2+d^2 x^2\right )+b \left (24-12 d^2 x^2+d^4 x^4\right )\right ) \cos (c+d x)\right )+2 d x \left (a d^2+2 b \left (-6+d^2 x^2\right )\right ) \sin (c+d x)}{d^5} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [B] Leaf count of result is larger than twice the leaf count of optimal. \(301\) vs.
\(2(111)=222\).
time = 0.05, size = 302, normalized size = 2.72
method | result | size |
risch | \(-\frac {\left (b \,x^{4} d^{4}+a \,d^{4} x^{2}-12 d^{2} x^{2} b -2 d^{2} a +24 b \right ) \cos \left (d x +c \right )}{d^{5}}+\frac {2 x \left (2 d^{2} x^{2} b +d^{2} a -12 b \right ) \sin \left (d x +c \right )}{d^{4}}\) | \(78\) |
norman | \(\frac {\frac {4 d^{2} a -48 b}{d^{5}}+\frac {b \,x^{4} \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}+\frac {\left (d^{2} a -12 b \right ) x^{2} \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d^{3}}-\frac {b \,x^{4}}{d}-\frac {\left (d^{2} a -12 b \right ) x^{2}}{d^{3}}+\frac {8 b \,x^{3} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d^{2}}+\frac {4 \left (d^{2} a -12 b \right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d^{4}}}{1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )}\) | \(146\) |
meijerg | \(\frac {16 b \sqrt {\pi }\, \sin \left (c \right ) \left (-\frac {x \left (d^{2}\right )^{\frac {5}{2}} \left (-\frac {5 d^{2} x^{2}}{2}+15\right ) \cos \left (d x \right )}{10 \sqrt {\pi }\, d^{4}}+\frac {\left (d^{2}\right )^{\frac {5}{2}} \left (\frac {5}{8} d^{4} x^{4}-\frac {15}{2} d^{2} x^{2}+15\right ) \sin \left (d x \right )}{10 \sqrt {\pi }\, d^{5}}\right )}{d^{4} \sqrt {d^{2}}}+\frac {16 b \sqrt {\pi }\, \cos \left (c \right ) \left (\frac {3}{2 \sqrt {\pi }}-\frac {\left (\frac {3}{8} d^{4} x^{4}-\frac {9}{2} d^{2} x^{2}+9\right ) \cos \left (d x \right )}{6 \sqrt {\pi }}-\frac {x d \left (-\frac {3 d^{2} x^{2}}{2}+9\right ) \sin \left (d x \right )}{6 \sqrt {\pi }}\right )}{d^{5}}+\frac {4 a \sqrt {\pi }\, \sin \left (c \right ) \left (\frac {x \left (d^{2}\right )^{\frac {3}{2}} \cos \left (d x \right )}{2 \sqrt {\pi }\, d^{2}}-\frac {\left (d^{2}\right )^{\frac {3}{2}} \left (-\frac {3 d^{2} x^{2}}{2}+3\right ) \sin \left (d x \right )}{6 \sqrt {\pi }\, d^{3}}\right )}{d^{2} \sqrt {d^{2}}}+\frac {4 a \sqrt {\pi }\, \cos \left (c \right ) \left (-\frac {1}{2 \sqrt {\pi }}+\frac {\left (-\frac {d^{2} x^{2}}{2}+1\right ) \cos \left (d x \right )}{2 \sqrt {\pi }}+\frac {d x \sin \left (d x \right )}{2 \sqrt {\pi }}\right )}{d^{3}}\) | \(256\) |
derivativedivides | \(\frac {-a \,c^{2} \cos \left (d x +c \right )-2 a c \left (\sin \left (d x +c \right )-\left (d x +c \right ) \cos \left (d x +c \right )\right )+a \left (-\left (d x +c \right )^{2} \cos \left (d x +c \right )+2 \cos \left (d x +c \right )+2 \left (d x +c \right ) \sin \left (d x +c \right )\right )-\frac {b \,c^{4} \cos \left (d x +c \right )}{d^{2}}-\frac {4 b \,c^{3} \left (\sin \left (d x +c \right )-\left (d x +c \right ) \cos \left (d x +c \right )\right )}{d^{2}}+\frac {6 b \,c^{2} \left (-\left (d x +c \right )^{2} \cos \left (d x +c \right )+2 \cos \left (d x +c \right )+2 \left (d x +c \right ) \sin \left (d x +c \right )\right )}{d^{2}}-\frac {4 b c \left (-\left (d x +c \right )^{3} \cos \left (d x +c \right )+3 \left (d x +c \right )^{2} \sin \left (d x +c \right )-6 \sin \left (d x +c \right )+6 \left (d x +c \right ) \cos \left (d x +c \right )\right )}{d^{2}}+\frac {b \left (-\left (d x +c \right )^{4} \cos \left (d x +c \right )+4 \left (d x +c \right )^{3} \sin \left (d x +c \right )+12 \left (d x +c \right )^{2} \cos \left (d x +c \right )-24 \cos \left (d x +c \right )-24 \left (d x +c \right ) \sin \left (d x +c \right )\right )}{d^{2}}}{d^{3}}\) | \(302\) |
default | \(\frac {-a \,c^{2} \cos \left (d x +c \right )-2 a c \left (\sin \left (d x +c \right )-\left (d x +c \right ) \cos \left (d x +c \right )\right )+a \left (-\left (d x +c \right )^{2} \cos \left (d x +c \right )+2 \cos \left (d x +c \right )+2 \left (d x +c \right ) \sin \left (d x +c \right )\right )-\frac {b \,c^{4} \cos \left (d x +c \right )}{d^{2}}-\frac {4 b \,c^{3} \left (\sin \left (d x +c \right )-\left (d x +c \right ) \cos \left (d x +c \right )\right )}{d^{2}}+\frac {6 b \,c^{2} \left (-\left (d x +c \right )^{2} \cos \left (d x +c \right )+2 \cos \left (d x +c \right )+2 \left (d x +c \right ) \sin \left (d x +c \right )\right )}{d^{2}}-\frac {4 b c \left (-\left (d x +c \right )^{3} \cos \left (d x +c \right )+3 \left (d x +c \right )^{2} \sin \left (d x +c \right )-6 \sin \left (d x +c \right )+6 \left (d x +c \right ) \cos \left (d x +c \right )\right )}{d^{2}}+\frac {b \left (-\left (d x +c \right )^{4} \cos \left (d x +c \right )+4 \left (d x +c \right )^{3} \sin \left (d x +c \right )+12 \left (d x +c \right )^{2} \cos \left (d x +c \right )-24 \cos \left (d x +c \right )-24 \left (d x +c \right ) \sin \left (d x +c \right )\right )}{d^{2}}}{d^{3}}\) | \(302\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 258 vs.
\(2 (111) = 222\).
time = 0.30, size = 258, normalized size = 2.32 \begin {gather*} -\frac {a c^{2} \cos \left (d x + c\right ) + \frac {b c^{4} \cos \left (d x + c\right )}{d^{2}} - 2 \, {\left ({\left (d x + c\right )} \cos \left (d x + c\right ) - \sin \left (d x + c\right )\right )} a c - \frac {4 \, {\left ({\left (d x + c\right )} \cos \left (d x + c\right ) - \sin \left (d x + c\right )\right )} b c^{3}}{d^{2}} + {\left ({\left ({\left (d x + c\right )}^{2} - 2\right )} \cos \left (d x + c\right ) - 2 \, {\left (d x + c\right )} \sin \left (d x + c\right )\right )} a + \frac {6 \, {\left ({\left ({\left (d x + c\right )}^{2} - 2\right )} \cos \left (d x + c\right ) - 2 \, {\left (d x + c\right )} \sin \left (d x + c\right )\right )} b c^{2}}{d^{2}} - \frac {4 \, {\left ({\left ({\left (d x + c\right )}^{3} - 6 \, d x - 6 \, c\right )} \cos \left (d x + c\right ) - 3 \, {\left ({\left (d x + c\right )}^{2} - 2\right )} \sin \left (d x + c\right )\right )} b c}{d^{2}} + \frac {{\left ({\left ({\left (d x + c\right )}^{4} - 12 \, {\left (d x + c\right )}^{2} + 24\right )} \cos \left (d x + c\right ) - 4 \, {\left ({\left (d x + c\right )}^{3} - 6 \, d x - 6 \, c\right )} \sin \left (d x + c\right )\right )} b}{d^{2}}}{d^{3}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.42, size = 77, normalized size = 0.69 \begin {gather*} -\frac {{\left (b d^{4} x^{4} - 2 \, a d^{2} + {\left (a d^{4} - 12 \, b d^{2}\right )} x^{2} + 24 \, b\right )} \cos \left (d x + c\right ) - 2 \, {\left (2 \, b d^{3} x^{3} + {\left (a d^{3} - 12 \, b d\right )} x\right )} \sin \left (d x + c\right )}{d^{5}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [A]
time = 0.32, size = 134, normalized size = 1.21 \begin {gather*} \begin {cases} - \frac {a x^{2} \cos {\left (c + d x \right )}}{d} + \frac {2 a x \sin {\left (c + d x \right )}}{d^{2}} + \frac {2 a \cos {\left (c + d x \right )}}{d^{3}} - \frac {b x^{4} \cos {\left (c + d x \right )}}{d} + \frac {4 b x^{3} \sin {\left (c + d x \right )}}{d^{2}} + \frac {12 b x^{2} \cos {\left (c + d x \right )}}{d^{3}} - \frac {24 b x \sin {\left (c + d x \right )}}{d^{4}} - \frac {24 b \cos {\left (c + d x \right )}}{d^{5}} & \text {for}\: d \neq 0 \\\left (\frac {a x^{3}}{3} + \frac {b x^{5}}{5}\right ) \sin {\left (c \right )} & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 2.89, size = 79, normalized size = 0.71 \begin {gather*} -\frac {{\left (b d^{4} x^{4} + a d^{4} x^{2} - 12 \, b d^{2} x^{2} - 2 \, a d^{2} + 24 \, b\right )} \cos \left (d x + c\right )}{d^{5}} + \frac {2 \, {\left (2 \, b d^{3} x^{3} + a d^{3} x - 12 \, b d x\right )} \sin \left (d x + c\right )}{d^{5}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 4.73, size = 97, normalized size = 0.87 \begin {gather*} \frac {x^2\,\cos \left (c+d\,x\right )\,\left (12\,b-a\,d^2\right )}{d^3}-\frac {2\,\cos \left (c+d\,x\right )\,\left (12\,b-a\,d^2\right )}{d^5}-\frac {2\,x\,\sin \left (c+d\,x\right )\,\left (12\,b-a\,d^2\right )}{d^4}-\frac {b\,x^4\,\cos \left (c+d\,x\right )}{d}+\frac {4\,b\,x^3\,\sin \left (c+d\,x\right )}{d^2} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________